package com.yonyou.cyxdms.basedata.service.baseService.service.controller.brand;

/**
 * // 自己约定消息类型在自定义字段中
 *
 * @author: houkaihua
 * @since: 2018/9/13
 * @updateDate:
 * @updateRemark:
 * @version:1.0 Copyright: Copyright (c) 2018
 */
public enum RMessageTypeEnum {
    TEXT(0, "text"),             // 普通文版
    NEWS(1, "news"),             // 图文消息
    IMAGE(2, "image"),           // 图片消息
    CREATECARD(3, "createCard"), // 建卡消息
    CREATECARD_BACK(4, "createCardBack"),         //  建卡回执
    ACTIVITY(5, "activity"),     // 活动推送
    PRICE(6, "price"),           // 车型报价
    VOICE(7, "voice"),           // 语音
    DRIVER(8, "driver"),         // 试乘试驾
    VIDEO(9, "video"),          // 视频
    FILE(10, "file"),            // 文件
    CARD(11, "miniprogrampage"),             //名片
    NOTIFY(12, "notify"),             //通知消息
    INVITATION(13, "invitation"),    //留资邀请
    XCXINIT(13, "xcxinit"),           //小程序初始化引导菜单
    LOCATION(14, "location"),     // 位置消息
    DRIVERBACK(15, "driverback"),//试驾回复消息
    OTHER(-1, "other");          // 其他

    private int key;
    private String value;

    private RMessageTypeEnum(int key, String value) {
        this.key = key;
        this.value = value;
    }

    public static RMessageTypeEnum getByKey(int key) {
        for (RMessageTypeEnum dot : RMessageTypeEnum.values()) {
            if (key == dot.getKey()) {
                return dot;
            }
        }
        return OTHER;
    }

    public static RMessageTypeEnum getByValue(String value) {
        for (RMessageTypeEnum dot : RMessageTypeEnum.values()) {
            if (value.equals(dot.getValue())) {
                return dot;
            }
        }
        return OTHER;
    }

    public int getKey() {
        return key;
    }

    public String getValue() {
        return value;
    }
}
